package summer_vacation.lvchang.myyVacation;
import java.util.Scanner;
/**
 * Created by Administrator on 2015/9/8.
 */
public class Text20 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        String Str = input.nextLine();
        int m = 0, n = 0;
        for (int i = 0; i < Str.length(); i++) {
            char c=Str.charAt(i);
            if (c >= 'a' && c <= 'z')
                n++;
            else if (c >= 'A' && c <= 'Z')
                m++;
        }
            if (n > m) {
                System.out.print(n);
            } else {
                System.out.print(m);
            }
        }
    }

